Adaptive contrast enhancement

ABSTRACT

Disclosed is a method for generating transfer curves for adaptive contrast enhancement. Given an input image, a luminance histogram is generated based on a set of predefined input luminance ranges. The luminance histogram is then expressed as a weighted sum of a set of predefined “primitive” histograms. Each primitive histogram has an associated reference transfer curve. A final transfer curve is produced as a corresponding weighted sum of the associated reference transfer curves. The image luminance can then be adjusted according the to the final transfer curve, resulting in enhanced image contrast. The disclosed method enables expansion of the number of available reference transfer curves without increasing the number of luminance ranges.

BACKGROUND OF THE INVENTION

The present invention relates generally to contrast enhancement and, more particularly, to a method for using primitive transfer curves to generate transfer curves for adaptive contrast enhancement.

Traditional contrast adjustment methods in displays and TVs do not take into account the input image content and result in unintended average brightness shifts as well as saturation or clipping. For example, poor results are obtained when increasing the contrast on an image which already has good contrast, and poor contrast is obtained when the image has a large portion of very bright or very dark pixels. Similarly, decreasing the contrast will typically “black out” images that already have poor contrast.

Therefore, improved contrast enhancement techniques are desired.

SUMMARY OF THE INVENTION

What is provided, therefore, is an adaptive contrast enhancement method that allows expansion of the number of available reference transfer curves without increasing the number of luminance ranges. Given an input image, a luminance histogram is generated. The luminance histogram is then expressed as a weighted sum of a set of predefined “primitive” histograms. Each primitive histogram has an associated reference transfer curve. A final transfer curve is produced as a corresponding weighted sum of the associated reference transfer curves. The image luminance can then be adjusted according the to the final transfer curve, resulting in enhanced image contrast.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:

FIG. 1 a shows an example medium-bright image and a histogram for the image, in accordance with an embodiment of the present invention.

FIG. 1 b shows an example dark (low-brightness) image and a histogram for the image, in accordance with an embodiment of the present invention.

FIG. 1 c shows three example luminance ranges, in accordance with an embodiment of the present invention.

FIG. 2 a shows an example image, and FIG. 2 b shows a luminance histogram for the example image generated based on the three example luminance ranges.

FIG. 3 shows an example set of nine primitive histograms H₁, . . . , H₉, in accordance with an embodiment of the present invention.

FIG. 4 a shows an example input image and associated histogram, and FIG. 4 b shows a contrast enhanced version of the image and associated histogram, in accordance with an embodiment of present invention.

FIGS. 5 a, 5 b and 5 c illustrate three example reference transfer curves TF₇(x), TF₈(x) and TF₉(x) corresponding to the three primitive histograms H₇, H₈ and H₉, in accordance with an embodiment of the present invention.

FIG. 6 is a flowchart illustrating a method for adaptively enhancing the contrast of an image, in accordance with an embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

Reference will now be made in detail to a particular embodiment of the invention, examples of which are illustrated in the accompanying drawings. While the invention will be described in conjunction with the particular embodiments, it will be understood that it is not intended to limit the invention to the described embodiments. To the contrary, it is intended to cover alternatives, modifications, and equivalents as may be included within the spirit and scope of the invention as defined by the appended claims.

When preparing an image for presentation, for example on a display such as a Liquid Crystal Display (LCD), an Organic Light Emitting Diode (OLED) screen, a Digital Light Processor (DLP), a Cathode Ray Tube (CRT), a plasma panel or other type of display, it is desirable to enhance the contrast of the image by adjusting pixel luminance levels. A transfer curve can be used for describing a mapping between input luminance levels and output luminance levels. Since different images have different luminance histograms, it is desirable to tailor the transfer curve to the particular image at hand in order to obtain optimal contrast enhancement.

One approach is to divide the luminance spectrum into a number of luminance ranges each associated with a reference transfer curve, sum the reference transfer curves proportional to the representation of their luminance ranges in the image, and use the sum as a transfer curve for processing the image luminance. While this approach works well, improving contrast enhancement by expanding the number of available reference transfer curves requires an increase in the number of luminance ranges, thereby adding boundary cases and producing uneven contrast enhancement during fade-ins and fade-outs (e.g. in a video stream). It is therefore desirable to expand the number of available reference transfer curves without increasing the number of predefined luminance ranges.

Accordingly, the present invention expands the number of available reference transfer curves without increasing the number of luminance ranges. First, a luminance histogram is generated for the image at hand. Then, the luminance histogram is expressed as a weighted sum of a set of predefined “primitive” histograms. The number of primitive histograms is larger than the number of luminance ranges, but the number of primitive histograms needed to adequately approximate the luminance histogram is generally smaller than the total number of available primitive histograms. Each primitive histogram has an associated reference transfer curve. A final transfer curve is produced as a corresponding weighted sum of the associated reference transfer curves. The image luminance can then be processed according to the final transfer curve, resulting in enhanced image contrast.

FIG. 1 a shows an example medium-bright image and a histogram for the image, and FIG. 1 b shows an example dark (low-brightness) image and a histogram for the image. The horizontal axes of the histograms represent luminance values and the vertical axes represent the number of pixels having a given luminance value. For example, for the dark scene in FIG. 1 b, the luminance histogram indicates that most of the pixels have low luminance, while for the medium-bright scene in FIG. 1 a the luminance histogram indicates a larger number of brighter pixels.

The invention will now be described using an example of three luminance ranges dividing the image luminance spectrum. It should be noted, however, that the following description is exemplary in nature and should therefore not be construed as limiting either the scope or intent of the invention.

In the present description, three example luminance ranges are used: a low-luminance range, a medium-luminance range and a high-luminance range. FIG. 1 c shows three example luminance ranges 11, 12 and 13, in accordance with an embodiment of the present invention. The luminance ranges are user-definable and may be chosen to overlap in order to provide for smooth contrast enhancement. By way of example, a low-luminance range of 0% to 40%, a medium-luminance range of 30% to 70%, and a high-luminance range of 60% to 100% luminance have been found to work well.

Once the luminance ranges are defined, generating a luminance histogram for the purposes of the present invention corresponds to counting the number of image pixels in each of the luminance ranges. In the example case of three luminance ranges, such a histogram can be visualized as having three bars, each bar representing the proportion of image pixels in a particular luminance range. FIG. 2 a shows an example image, and FIG. 2 b shows a luminance histogram for the example image generated based on the three luminance ranges. The generation of image luminance histograms is preferably done in hardware, although it should be appreciated that this can also be done partially or entirely in software or other computing layer.

After generating a luminance histogram (hereinafter referred to as the source histogram) for an input image, the goal is to express the source histogram as a weighted sum of a set of predefined primitive histograms. FIG. 3 shows an example set of nine primitive histograms H₁, . . . , H₉, in accordance with an embodiment of the present invention. H₁ can be described as dark with the darkness monotonically falling, H₂ as bright with the brightness monotonically rising, H₃ as uniformly bright, H₄ as dark without distinct bright details, H₅ as bright without distinct dark details, H₆ as distinct dark and bright regions, H₇ as very dark, H₈ as medium bright, and H₉ as very bright.

The source histogram can be expressed as a weighted sum of two or more primitive histograms (with positive weights). The weighted sum may not match the source histogram exactly, but it will closely resemble the source histogram. One greedy algorithm for generating such a weighted sum is to choose a first primitive histogram which, when appropriately weighted using a maximal positive weight, leaves the smallest difference with the source histogram. The remaining difference (if any) between the source histogram and the first weighted primitive histogram is then similarly diminished by choosing a second primitive histogram which, when appropriately weighted using a maximal positive weight and added to the first weighted primitive histogram, leaves the smallest difference between the weighted sum and the source histogram.

By way of example, assuming that H₁ and H₅ were chosen among all the primitive histograms to serve as the first and second primitive histograms in the above algorithm, their weighted sum can be written as w₁·H₁+w₂·H₅, with w₁ and w₂ representing the appropriately chosen positive weights. Optionally, the above algorithm can be continued to include additional primitive histograms for producing a weighted sum of three or more primitive histograms. It is contemplated that a weighted sum of two or three primitive histograms will approximate source histograms closely enough to enable a highly enhanced image contrast.

Another heuristic for generating a weighted sum of primitive histograms for the image first generates a preliminary histogram for the image using only two bins, with the first bin representing the lower half of the luminance spectrum and the second bin representing the higher half. The preliminary histogram is then used to indicate whether the image has low-luminance (first bin contains significantly more pixels than second bin), medium-luminance (first and second bins contain about the same number of pixels) or high-luminance (second bin contains significantly more pixels than second bin). The threshold can be defined explicitly. For example, if the less represented bin contains 45% of the pixels, the image is declared to have medium-luminance, else the image is declared low-luminance or high-luminance. For a low-luminance image, the high-luminance primitive histograms H₂ and H₉ are excluded from consideration for the weighted sum. For a high-luminance image, the low-luminance histograms H₁ and H₇ are excluded. For a medium-luminance image, the low-luminance and high-luminance primitive histograms H₂, H₉, H₁ and H₇ are excluded. The source histogram is then expressed as a weighted sum of the non-excluded primitive histograms using the above greedy algorithm.

The primitive histograms are preferably chosen and added by firmware for improved performance, although it should be appreciated that this can also be done fully or partially in software or other computing layer.

Once an appropriate weighted sum of primitive histograms is obtained, a final transfer curve is generated. Corresponding to the primitive histograms H₁, . . . , H₉ are user-defined reference transfer curves TF₁(x), . . . , TF₉(x), wherein TF₁(x) represents a reference transfer curve generated to be suitable for enhancing the contrast of an image whose histogram resembles the primitive histogram H₁. By way of example, U.S. patent application Ser. No. ______, entitled “Method of Generating Transfer Curves for Adaptive Contract Enhancement” and incorporated herein by reference, describes one way of generating transfer curves suitable for such histograms, wherein bright pixels are made brighter in generally dark or medium-bright images, and dark pixels are made darker in generally bright or medium-bright images.

By way of example, FIGS. 5 a, 5 b and 5 c illustrate three such example reference transfer curves TF₇(x), TF₈(x) and TF₉(x), corresponding to the primitive histograms H₇, H₈ and H₉, in accordance with an embodiment of the present invention. Note that TF₇(x) decreases the luminance in the dark regions of the image without substantially changing the luminance in the medium- and high-luminance regions; TF₉(x) increases luminance in the bright regions of the image without substantially changing the luminance in the medium- and low-luminance regions; and TF₈(x) increases the luminance in the high-luminance regions and decreases the luminance in the low-luminance regions without substantially changing the luminance in the medium-luminance range of the image.

The final transfer curve T(x) is produced as a weighted sum of the corresponding reference transfer curves: T(x)=w₁·TF₁(x)+w₂·TF₅(x). The weights used to produce the final transfer curve correspond to the weights used for the primitive histograms. The final transfer curve T(x) can then be used to adjust the pixel luminances of the image, thereby enhancing the contrast of the image.

In general, the number of primitive histograms used in a weighted sum, and therefore the number of reference transfer curves used in a corresponding weighted sum, can be limited to two or three per weighted sum. However, the above examples are for illustration purposes only. There can be any number of primitive histograms H_(i) and corresponding reference transfer curves T_(i)(x) to choose from, any number of primitive histograms can be chosen for inclusion in the weighted sum $\sum\limits_{i}{w_{i} \cdot H_{i}}$ for approximating the source histogram, and any corresponding number of reference transfer curves can be chosen for inclusion in the weighted sum $\sum\limits_{i}{w_{i} \cdot {T_{i}(x)}}$ representing the final transfer curve T(x).

FIG. 6 is a flowchart illustrating a method for adaptively enhancing the contrast of an image, in accordance with an embodiment of the present invention. Given an input image, generate 101 a histogram and express 102 the histogram as a weighted sum of primitive histograms. Then generate 103 a final transfer curve as a corresponding weighted sum of the reference transfer curves associated with the primitive histograms. Once the final transfer curve is generated, the image luminance can be adjusted 104 accordingly.

For smooth contrast enhancement in a sequence of images (such as in a video stream), the final transfer function can be generated based on the cumulative image content of the most recent frames. One implementation of this technique comprises accumulating the histograms of the most recent set of frames and computing their average. The resulting average histogram is then expressed as a weighted sum of primitive histograms, producing a final transfer function as described above. When implementing such an averaging technique, a buffer of 5 to 15 frames has been found to work well.

One advantage of the present invention is faster development of the reference transfer curves. A given reference transfer curve corresponding to a given primitive histogram needs only be verified on images that have luminance histograms similar to the given primitive histogram. In the above example set of nine primitive histograms, only nine corresponding transfer curves need to be designed and thusly verified. This dramatically cuts development time, since the reference transfer curves do not need to be verified and optimized against many hours of material encompassing many different primitive histograms in order to discover side effects due to interdependence of reference transfer curves.

Another advantage of the present invention is a reduced need for hardware resources. Using the above example of only 3 luminance histogram ranges (or histogram “bins”), it is possible to achieve contrast enhancement performance comparable to or better than using 8 or 16 bins in a traditional contrast enhancement approach.

Another advantage of the present invention is improved contrast dynamic range without sacrificing the luminance resolution of the image. By way of example, an input original image and associated histogram are shown in FIG. 4 a, and the enhanced output image and associated histogram are shown in FIG. 4 b. Note that in the luminance histogram of the enhanced image, the dark and bright pixels are spread out further (i.e. increased dynamic range), whereas the medium-luminance pixels are mostly unaffected.

While the invention has been described in the context of displaying an image on a digital display device, it should be appreciated that the same techniques can be used in an environment where the adaptive contrast enhancement is limited to a region in the display. By way of example, adaptive contrast enhancement for a movie may exclude the upper and lower black bands that run horizontally across the display or screen. By way of another example, adaptive contrast enhancement may be restricted to a user-definable region of the display, such as a window or a physical region of the display.

Foregoing described embodiments of the invention are provided as illustrations and descriptions. They are not intended to limit the invention to precise form described. Other variations and embodiments are possible in light of above teachings, and it is thus intended that the scope of invention not be limited by this Detailed Description, but rather by Claims following. 

1. A method for generating a transfer function, comprising: approximating an image luminance histogram by a first weighted sum of a set of primitive histograms, each primitive histogram associated with a corresponding reference transfer function from a set of reference transfer functions; and generating a final transfer function expressed as a second weighted sum of the set of reference functions; wherein the reference functions in the second weighted sum are weighted according to the associated primitive histograms in the first weighted sum.
 2. A method as recited in claim 1, further comprising: generating the image luminance histogram based on an input image.
 3. A method as recited in claim 1, wherein each reference transfer function of the set of reference transfer functions is chosen to optimally enhance the contrast of images that have luminance values distributed according to the primitive histogram associated with the reference transfer function.
 4. A method as recited in claim 1, wherein a first reference transfer function of the set of reference transfer functions decreases luminance in dark image regions without substantially altering luminance in medium-luminance and high-luminance image regions, the first reference transfer function associated with a primitive histogram that indicates predominantly bright images.
 5. A method as recited in claim 1, wherein a first reference transfer function of the set of reference transfer functions increases luminance in bright image regions without substantially altering luminance in medium-luminance and low-luminance image regions, the first reference transfer function associated with a primitive histogram that indicates predominantly dark images.
 6. A method as recited in claim 1, wherein the first weighted sum comprises at most two primitive histograms with positive weights, and the second weighted sum comprises at most two reference transfer curves with positive weights.
 7. A method as recited in claim 1, wherein the first weighted sum comprises at most three primitive histograms with positive weights, and the second weighted sum comprises at most three reference transfer curves with positive weights.
 8. A method for adaptive contrast enhancement, comprising: generating a luminance histogram (source histogram) for an input image; approximating the source histogram by a first weighted sum of a set of primitive histograms, each primitive histogram associated with a corresponding reference transfer function from a set of reference transfer functions; generating a final transfer function expressed as a second weighted sum of the set of reference transfer functions; and adjusting input image pixel luminances according to the final transfer function to produce an output image; wherein the reference transfer functions in the second weighted sum are weighted according to the associated primitive histograms in the first weighted sum.
 9. A method as recited in claim 8, further comprising: receiving the input image.
 10. A method as recited in claim 8, further comprising: displaying the output image on a display.
 11. A method as recited in claim 10, wherein the display is selected from the group consisting of an LCD screen, an OLED screen, a DLP screen, a CRT and a plasma panel.
 12. A method as recited in claim 8, wherein each reference transfer function of the set of reference transfer functions is chosen to optimally enhance the contrast of images that have luminance values distributed according to the primitive histogram associated with the reference transfer function.
 13. A method as recited in claim 8, wherein a first reference transfer function of the set of reference transfer functions decreases luminance in dark image regions without substantially altering luminance in medium-luminance and high-luminance image regions, the first reference transfer function associated with a primitive histogram that indicates predominantly bright images.
 14. A method as recited in claim 8, wherein a first reference transfer function of the set of reference transfer functions increases luminance in bright image regions without substantially altering luminance in medium-luminance and low-luminance image regions, the first reference transfer function associated with a primitive histogram that indicates predominantly dark images.
 15. A method as recited in claim 8, wherein the first weighted sum comprises at most two primitive histograms with positive weights, and the second weighted sum comprises at most two reference transfer curves with positive weights.
 16. A method as recited in claim 8, wherein the first weighted sum comprises at most three primitive histograms with positive weights, and the second weighted sum comprises at most three reference transfer curves with positive weights.
 17. An apparatus for generating a transfer function, comprising: a controller for: (a) approximating an image luminance histogram by a first weighted sum of a set of primitive histograms, each primitive histogram associated with a corresponding reference transfer function from a set of reference transfer functions; and (b) generating a final transfer function expressed as a second weighted sum of the set of reference transfer functions; wherein the reference transfer functions in the second weighted sum are weighted according to the associated primitive histograms in the first weighted sum.
 18. An apparatus as recited in claim 17, the controller further for: generating the image luminance histogram based on an input image.
 19. An apparatus as recited in claim 17, wherein each reference transfer function of the set of reference transfer functions is chosen to optimally enhance the contrast of images that have luminance values distributed according to the primitive histogram associated with the reference transfer function.
 20. An apparatus as recited in claim 17, wherein a first reference transfer function of the set of reference transfer functions decreases luminance in dark image regions without substantially altering luminance in medium-luminance and high-luminance image regions, the first reference transfer function associated with a primitive histogram that indicates predominantly bright images.
 21. An apparatus as recited in claim 17, wherein a first reference transfer function of the set of reference transfer functions increases luminance in bright image regions without substantially altering luminance in medium-luminance and low-luminance image regions, the first reference transfer function associated with a primitive histogram that indicates predominantly dark images.
 22. An apparatus as recited in claim 17, wherein the first weighted sum comprises at most two primitive histograms with positive weights, and the second weighted sum comprises at most two reference transfer curves with positive weights.
 23. An apparatus as recited in claim 17, wherein the first weighted sum comprises at most three primitive histograms with positive weights, and the second weighted sum comprises at most three reference transfer curves with positive weights.
 24. An apparatus for adaptive contrast enhancement, comprising: a controller for: (a) generating a luminance histogram (source histogram) for an input image; (b) approximating the source histogram by a first weighted sum of a set of primitive histograms, each primitive histogram associated with a corresponding reference transfer function from a set of reference transfer functions; (c) generating a final transfer function expressed as a second weighted sum of the set of reference functions; and (d) adjusting input image pixel luminances according to the final transfer curve to produce an output image; wherein the reference functions in the second weighted sum are weighted according to the associated primitive histograms in the first weighted sum.
 25. A method as recited in claim 24, the controller further for: receiving the input image.
 26. A method as recited in claim 24, the controller further for: displaying the output image on a display.
 27. A method as recited in claim 26, wherein the display is selected from the group consisting of an LCD screen, an OLED screen, a DLP screen, a CRT and a plasma panel.
 28. A method as recited in claim 24, wherein each reference transfer function of the set of reference transfer functions is chosen to optimally enhance the contrast of images that have luminance values distributed according to the primitive histogram associated with the reference transfer function.
 29. A method as recited in claim 24, wherein a first reference transfer function of the set of reference transfer functions decreases luminance in dark image regions without substantially altering luminance in medium-luminance and high-luminance image regions, the first reference transfer function associated with a primitive histogram that indicates predominantly bright images.
 30. A method as recited in claim 24, wherein a first reference transfer function of the set of reference transfer functions increases luminance in bright image regions without substantially altering luminance in medium-luminance and low-luminance image regions, the first reference transfer function associated with a primitive histogram that indicates predominantly dark images.
 31. A method as recited in claim 24, wherein the first weighted sum comprises at most two primitive histograms with positive weights, and the second weighted sum comprises at most two reference transfer curves with positive weights.
 32. A method as recited in claim 24, wherein the first weighted sum comprises at most three primitive histograms with positive weights, and the second weighted sum comprises at most three reference transfer curves with positive weights. 